#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    int ncase;
    cin>>ncase;
    while(ncase--)
    {
        int n,a[110],i,max=0,cnt=0,tmp,ans;
        memset(a,0,110);
        cin>>n;
        for(i=0;i<n;i++)
        {
            cin>>tmp;
            if(tmp>max) max=tmp;
            if(a[tmp]==0)
            {
                cnt++;
                a[tmp]=1;
            }
        }
        ans=10*max+cnt*5+n;
        cout<<ans<<endl;
    }
    return 0;
}
